#!/bin/bash
#author merci
#修改mysql密码

echo "Please input old password"
read  o
echo "Please inpput new password"
read  n
echo "Please inpput repassword"
read  r
if [ $n != $r ]; then
        echo "Password Inconsistent !"
        exit 1
fi
mysql -u root -p$o << EOF
use mysql;
update user set password=password("$n") where user="root";
flush privileges;
exit
EOF